export var StructureGraph: { [key: string]: string } = {};
StructureGraph[STRUCTURE_SPAWN] = '🥎';
StructureGraph[STRUCTURE_CONTAINER] =   '📒';
StructureGraph[STRUCTURE_EXTENSION] =   '🟡';
StructureGraph[STRUCTURE_LAB] =   '🧪';
StructureGraph[STRUCTURE_LINK] =  '🔶';

StructureGraph[STRUCTURE_ROAD] =  '⚫';
StructureGraph[STRUCTURE_RAMPART] =  '🟩';
StructureGraph[STRUCTURE_WALL] = '⬛';

StructureGraph[STRUCTURE_STORAGE] =  '🧇';
StructureGraph[STRUCTURE_TERMINAL] =   '📺';
StructureGraph[STRUCTURE_TOWER] =   '🚀';
StructureGraph[STRUCTURE_FACTORY] = '🏟️';
StructureGraph[STRUCTURE_OBSERVER] = '🕳️';
StructureGraph[STRUCTURE_POWER_SPAWN] = '🔴';
StructureGraph[STRUCTURE_NUKER] = '⚡';
export class VisualHelper 
{
   static drawMatrix(room:Room,costs:CostMatrix)
    {
        for(let i=0;i<50;i++)
        {
            for(let j=0;j<50;j++)
            {
                if(costs.get(i,j) == 0xff)
                {
                    room.visual.text(`X`,i,j,{color:"red",font:0.5});
                }else if(costs.get(i,j) >= 0x18)
                {
                    room.visual.text(`H`,i,j,{color:"yellow",font:0.5});
                }
                
            }
        }
    }


    
    public static drawRoom(room:Room,ConstructQueue:ISiteQueue)
    {

       const roomVisual = room;

        for( const item of ConstructQueue.items)
        {
           const draw = StructureGraph[ item.type];
           if(draw )
           {
               roomVisual.visual.text(draw, item.pos.x, item.pos.y, { color: 'red', font: 0.6 });
           }
       }

    }

    public static drawPath(  poss:RoomPosition[])
    {
        const group =  _.groupBy(poss,e=>e.roomName)
        for(let k in group)
        {
            if(Game.rooms[k])
            {
                Game.rooms[k].visual.poly(group[k], { stroke: 'red', lineStyle: 'dashed', strokeWidth: 0.15 });
            }
             
        }
       //  room.visual.poly(poss.filter(e=>e.roomName == room.name), { stroke: 'red', lineStyle: 'dashed', strokeWidth: 0.15 });
    //     const roomVisual = room;

    //     for( const item of ConstructQueue.items)
    //     {
    //        const draw = StructureGraph[ item.type];
    //        if(draw )
    //        {
    //            roomVisual.visual.text(draw, item.pos.x, item.pos.y, { color: 'red', font: 0.6 });
    //        }
    //    }

    }
}